package com.liy.cloud.common.pw.entity;


import com.liy.cloud.common.pw.utils.MoneyType;
import com.das.framework.common.vo.BaseVO;

/**
 * @author libs
 * @date 2019/1/8 10:55:06
 * @description 车站设备票款库存明细从表
 */
public class PwDeviceMoneyDetailEntity extends BaseVO<String> {

    private static final long serialVersionUID = 1L;

    /*
     * 主表
     */
    private String mainId;

    /*
     * 设备编号
     */
    private String deviceId;
    private String deviceIdName;

    /*
     * 钱币种类
     */
    private String moneyType;
    private String moneyTypeDesc;

    /*
     * 钱币数量
     */
    private Double moneyNum;

    /*
     * 钱数
     */
    private Double money;

    public String getMainId() {
        return mainId;
    }

    public void setMainId(String mainId) {
        this.mainId = mainId;
    }

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public String getMoneyType() {
        return moneyType;
    }

    public void setMoneyType(String moneyType) {
        this.moneyType = moneyType;
    }

    public Double getMoneyNum() {
        return moneyNum;
    }

    public void setMoneyNum(Double moneyNum) {
        this.moneyNum = moneyNum;
    }

    public Double getMoney() {
        if(this.moneyNum != null && this.moneyType != null){
            MoneyType moneyType = MoneyType.getByCode(this.moneyType);
            if(moneyType != null){
                this.money = this.moneyNum * moneyType.getValueYuan();
            }
        } else {
            money = 0.0;
        }
        return money;
    }

    public void setMoney(Double money) {
        this.money = money;
    }

    public String getDeviceIdName() {
        return deviceIdName;
    }

    public void setDeviceIdName(String deviceIdName) {
        this.deviceIdName = deviceIdName;
    }

    public String getMoneyTypeDesc() {
        this.moneyTypeDesc = MoneyType.getByCode(this.moneyType).getDesc();
        return this.moneyTypeDesc;
    }

    public void setMoneyTypeDesc(String moneyTypeDesc) {
        this.moneyTypeDesc = moneyTypeDesc;
    }
}
